Northwoods.GoWPF 2.2.4 Assembly
CopyNode2 Method (GraphModel<NodeType,NodeKey>)

the original node data
the dictionary mapping original objects to copied objects
the copied node data
for convenience, the copied "parent" node data
for convenience, a list of newly copied member nodes
for convenience, a list of newly copied nodes that the new data is connected from
for convenience, a list of newly copied nodes that the new data is connected to
This is the second pass of copying node data, responsible for fixing up references to other objects.
Syntax
Protected Overridable Sub CopyNode2( _
   ByVal oldnodedata As NodeType, _
   ByVal env As GraphModel(Of NodeType,NodeKey), _
   ByVal newnodedata As NodeType, _
   ByVal newgroup As NodeType, _
   ByVal newmembers As IEnumerable(Of NodeType), _
   ByVal newfroms As IEnumerable(Of NodeType), _
   ByVal newtos As IEnumerable(Of NodeType) _
) 

Parameters

oldnodedata
the original node data
env
the dictionary mapping original objects to copied objects
newnodedata
the copied node data
newgroup
for convenience, the copied "parent" node data
newmembers
for convenience, a list of newly copied member nodes
newfroms
for convenience, a list of newly copied nodes that the new data is connected from
newtos
for convenience, a list of newly copied nodes that the new data is connected to
Remarks

You will want to override this method if the node data should have any references to copied data. Otherwise the copied node will appear to have links to the original nodes, not to the copied nodes.

Your overridden method may want to do something like what this method does by default: // this assumes the node data has a modifiable collection of "from" node references // if not, you could instead construct your own list of keys and call ModifyFromNodeKeys if (this.FromNodesPath != "" && newfroms != null) { // remove any old keys; not needed if the copied property value is empty foreach (NodeKey k in FindFromNodeKeysForNode(newnodedata).OfType<NodeKey>().ToList()) { DeleteFromNodeKey(newnodedata, k); } // add new keys (which should be different from the old keys) foreach (NodeType newfrom in newfroms) { NodeKey newfromkey = FindKeyForNode(newfrom); InsertFromNodeKey(newnodedata, newfromkey); } } // this assumes the node data has a modifiable collection of "to" node references; // if not, you could instead construct your own list of keys and call ModifyToNodeKeys if (this.ToNodesPath != "" && newtos != null) { // remove any old keys; not needed if the copied property value is empty foreach (NodeKey k in FindToNodeKeysForNode(newnodedata).OfType<NodeKey>().ToList()) { DeleteToNodeKey(newnodedata, k); } // add new keys (which should be different from the old keys) foreach (NodeType newto in newtos) { NodeKey newtokey = FindKeyForNode(newto); InsertToNodeKey(newnodedata, newtokey); } } // this assumes the node data has a reference to its container group if (this.GroupNodePath != "" && newgroup != null) { ModifyGroupNodeKey(newnodedata, FindKeyForNode(newgroup)); } // this assumes the node data has a modifiable collection that InsertMemberNodeKey can work with; // if not, you could instead construct your own list of keys and call ModifyMemberNodeKeys. if (this.MemberNodesPath != "" && newmembers != null) { // remove any old keys; not needed if the copied property value is empty foreach (NodeKey k in FindMemberNodeKeysForNode(newnodedata).OfType<NodeKey>().ToList()) { DeleteMemberNodeKey(newnodedata, k); } // add new keys (which should be different from the old keys) foreach (NodeType newmem in newmembers) { NodeKey newmemkey = FindKeyForNode(newmem); InsertMemberNodeKey(newnodedata, newmemkey); } }

Requirements
See Also

Reference

GraphModel<NodeType,NodeKey> Class
GraphModel<NodeType,NodeKey> Members

 

 


© Northwoods Software 2017. All Rights Reserved.

Send Feedback